// https://codeforces.com/contest/689/problem/C

#include <bits/stdc++.h>

#define endl "\n"
#define pii pair<int, int>

using namespace std;
using i64 = long long;

const int N = 1e6 + 10;

i64 m;

i64 get(i64 n) {
    i64 res = 0;
    for (i64 i = 2; i * i * i <= n; i++) {
        res += n / (i * i * i * 1LL);
    }
    return res;
}

void solve() {
    cin >> m;

    i64 l = 0, r = 1e16;
    while (l + 1 < r) {
        i64 mid = l + r >> 1;
        if (get(mid) < m) l = mid;
        else r = mid;
    }

    if (get(r) == m) {
        cout << r << endl;
    } else {
        cout << "-1\n";
    }
}

int main() {
    ios::sync_with_stdio(0);
    cout.tie(0), cin.tie(0);

    int _ = 1;
    // cin >> _;
    while (_--) solve();

    return 0;
}